/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.shinyray.project.bpm.task.entity;

import com.shinyray.project.entity.Project;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Temporal;

/**
 * 与项目相关的任务，一般需要被细化为具体的任务。
 * @author Administrator
 */
@Entity
public class ProjectTask implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    //任务所属项目
    @ManyToOne
    private Project project;
    //开始时间
    //任务执行者标识符
    private String executorUserAccountID;
    //任务执行者姓名
    private String executorName;
    //产生的时间
    @Temporal(javax.persistence.TemporalType.DATE)
    private Date createDate;
    //任务类型
    private String taskType;
    //任务状态(待处理、处理中、已处理、已取消、已跳转、已转交处理)
    private String status;
    //处理动作（拒绝、通过、转交处理等）
    private String actionType;
    //处理说明
    private String comments;
    //处理时间
    @Temporal(javax.persistence.TemporalType.DATE)
    private Date closeDate;
    //产生的下一批任务
    @OneToMany
    private List<ProjectTask> nextTaskInstanceList;
    //上一任务
    @OneToOne
    private ProjectTask previousTaskInstance;
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ProjectTask)) {
            return false;
        }
        ProjectTask other = (ProjectTask) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.shinyray.project.bpm.task.entity.ProjectTask[id=" + id + "]";
    }

}
